package org.come.Jpanel;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.*;

import org.come.mouslisten.GangsGuardMouslisten;
import org.come.until.FormsManagement;

import com.tool.tcpimg.UIUtils;

public class GangsGuardJpanel extends JPanel {

	private JLabel[] labResistance = new JLabel[11];
	private GangsGuardMouslisten[] guardMouslistens = new GangsGuardMouslisten[11];
	private JLabel labCrap,// 放置废话
			labPassby;// 路过

	public GangsGuardJpanel() {
		this.setPreferredSize(new Dimension(600, 200));
		this.setLayout(null);
		// 各个帮派守护抗性
		for (int i = 0; i < 11; i++) {
			int row = i % 5;
			int col = i / 5;
			labResistance[i] = new JLabel();
			labResistance[i].setForeground(Color.green);
			labResistance[i].setBounds(20 + row * 116, 60 + col * 25, 70, 18);
			labResistance[i].setFont(UIUtils.TEXT_FONT);
			guardMouslistens[i] = new GangsGuardMouslisten(i);
			labResistance[i].addMouseListener(guardMouslistens[i]);
			this.add(labResistance[i]);
		}
		// 放置废话
		labCrap = new JLabel();
		labCrap.setFont(new Font("宋体", 0, 14));
		labCrap.setBounds(11, 10, 340, 25);
		labCrap.setForeground(Color.white);
		labCrap.setText("我是帮派守护非常荣幸给您服务你想要什么样的服务。");
		this.add(labCrap);
		// 路过
		labPassby = new JLabel();
		labPassby.setFont(UIUtils.TEXT_FONT);
		labPassby.setBounds(16, 155, 72, 18);
		labPassby.setForeground(Color.green);
		labPassby.setText("我只是路过。");
		labPassby.addMouseListener(new MouseListener() {

			@Override
			public void mouseReleased(MouseEvent e) {
				// TODO Auto-generated method stub

			}

			@Override
			public void mousePressed(MouseEvent e) {
				// TODO Auto-generated method stub

			}

			@Override
			public void mouseExited(MouseEvent e) {
				// TODO Auto-generated method stub

			}

			@Override
			public void mouseEntered(MouseEvent e) {
				// TODO Auto-generated method stub

			}

			@Override
			public void mouseClicked(MouseEvent e) {

				FormsManagement.HideForm(53);

			}
		});
		this.add(labPassby);

	}
	public static ImageIcon icon;
	@Override
	protected void paintComponent(Graphics g) {
		super.paintComponent(g);
		if (icon == null) {
			icon = new ImageIcon("inkImg/hongmu/2/95_png.xy2uiimg.npctalk.png");
		}

			g.drawImage(icon.getImage(), 0, 0, 600, 200, this);

	}

	public JLabel[] getLabResistance() {
		return labResistance;
	}

	public void setLabResistance(JLabel[] labResistance) {
		this.labResistance = labResistance;
	}

	public JLabel getLabCrap() {
		return labCrap;
	}

	public void setLabCrap(JLabel labCrap) {
		this.labCrap = labCrap;
	}

	public JLabel getLabPassby() {
		return labPassby;
	}

	public void setLabPassby(JLabel labPassby) {
		this.labPassby = labPassby;
	}

}
